package com.sky.controller;

import com.sky.result.Result;
import com.sky.service.CommonService;
import io.swagger.annotations.Api;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/common")
@Slf4j
@Api(tags = "通用接口")
public class CommonController {

  @Autowired
  CommonService commonService;

  @PostMapping("/verify-email")
  public Result verifyEmail(@RequestParam(value = "email") String email) {
    log.info("验证邮箱，{}", email);
    String verifyCode = commonService.sendVerifycode(email);
    log.info("向{}发送的验证码为{}",email,verifyCode);
    return Result.success();
  }
}
